﻿using CommonUtil;
using Newtonsoft.Json.Linq;
using System;

namespace CommonUtilTest {
    class Program {
        static void Main(string[] args) {
            //LogUtil.logger.Info("日志");

            JObject jObject = new JObject();

            Console.WriteLine(jObject["test"] == null);

            SocketClient socket = new SocketClient("ws://127.0.0.1:3000");
            socket.On("connection", Socket_open);
            socket.On("error", Socket_error);
            socket.On("close", Socket_close);
            socket.Open();
            Console.ReadKey();
        }

        public static object Socket_open(object e) {
            Console.WriteLine("socket已连接");
            return null;
        }

        public static object Socket_close(object e) {
            Console.WriteLine("socket断开");
            return null;
        }

        public static object Socket_error(object e) {
            Exception err = (Exception)e;
            Console.WriteLine("socket错误" + err.Message);
            return null;
        }
    }
}
